<script>
    function showMsg(message, err = false) {
        if (err) {
            $('body').prepend('<div id="myAlert" class="center-block alert alert-success fade in" style="width: 45%;text-align: center;">' +
                '<a href="#" class="close" data-dismiss="alert">&times;</a><strong>成功！</strong>' + message + '</div>');
        } else {
            $('body').prepend('<div id="myAlert" class="center-block alert alert-danger fade in" style="width: 45%;text-align: center;">' +
                '<a href="#" class="close" data-dismiss="alert">&times;</a><strong>失败！</strong>' + message + '</div>');
        }
        closeMsg();
    }

    function closeMsg() {
        setTimeout(function () {
            $('#myAlert').alert('close');
        }, 2000);
    }
</script>
</html>